//
//  BlurIntroductionViewController.m
//  logistics
//
//  Created by Rui on 15/6/17.
//  Copyright (c) 2015年 dianchuang. All rights reserved.
//

#import "BlurIntroductionViewController.h"
#import "RootTabViewController.h"

@interface BlurIntroductionViewController ()

@property(strong,nonatomic) UIScrollView *scrollView;

@end

@implementation BlurIntroductionViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self initWithView];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)initWithView{
    
    self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds))];
    self.scrollView.contentSize = CGSizeMake(CGRectGetWidth(self.view.bounds)*3, CGRectGetHeight(self.view.bounds));
    self.scrollView.showsVerticalScrollIndicator = NO;
    self.scrollView.pagingEnabled = YES;
    self.scrollView.bounces = NO;
    for (int i=0; i<3; i++) {
        
        UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(CGRectGetWidth(self.view.bounds)*i, 0, CGRectGetWidth(self.view.bounds), CGRectGetHeight(self.view.bounds))];
        imageView.image = [UIImage imageNamed:[NSString stringWithFormat:@"0%ld",(long)i+1]];
        imageView.userInteractionEnabled = YES;
        [self.scrollView addSubview:imageView];
        
        if(i==2){
            //添加手势
            UITapGestureRecognizer *grz=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(gotoRootTab)];
            [imageView addGestureRecognizer:grz];
        }
    }
    
    [self.view addSubview:self.scrollView];
}

-(void)gotoRootTab{
    [kUserdefaults setValue:@"1" forKey:@"blurIntroduction"];
    [kUserdefaults synchronize];
    RootTabViewController *root = [[RootTabViewController alloc]init];
    [self presentViewController:root animated:YES completion:nil];
}

@end
